<template>
  <el-button type="primary" @click="count++"> count is: {{ count }}</el-button>
  <el-form :model="form" label-width="130px">
    <el-form-item label="用户名:">
      <el-input type="text" v-model="form.name" placeholder="用户名" />
    </el-form-item>
    <el-form-item label="密码">
      <el-input type="password" v-model="form.password" placeholder="密码" />
    </el-form-item>
  </el-form>
</template>

<script lang="ts">
  import { ref, defineComponent, reactive, getCurrentInstance } from 'vue'
  import { login } from '@/api/user'
  export default defineComponent({
    name: 'HelloWorld',
    props: {
      msg: {
        type: String,
        required: true
      }
    },
    setup: () => {
      const { proxy } = getCurrentInstance()
      const count = ref(0)
      const form = reactive({
        name: '',
        passowrd: ''
      })
      let addNum = async () => {
        let params = {
          backstageType: 1,
          password: 'JhlTn9jyyjNsDyVFXpsFlw==',
          username: '13312341111'
        }
        let { code, data } = await login(params)
        if (code == 200) {
          console.log(data)
          proxy.$message.success('成功')
        }
      }
      return { count, addNum, form }
    }
  })
</script>

<style scoped></style>
